<?php
include 'secure/core.php';
include 'user_header.php';
include 'left.php'; 
$sql = "SELECT * FROM `settings`";          
$res = $ado->exec($sql);
$row_array = mysql_fetch_assoc($res);
?>
		<div id="right">
		<div class="section">
				<div class="box">
					<div class="title">
						Referral Link
						<span class="hide"></span>
					</div>
					<div class="content">
					<form action="">
						<div class="row">
						Refer users to our site and earn <?php echo $row_array['referral_percent']; ?>% of their earnings. You can use the available promotion tools as you wish.
						</div>
						<div class="row">
							<label>Your Ref Link</label>
							<div class="right"><input type="text" readonly="readonly" value="<?php echo $settings->getSiteURL(); ?>register.php?ref=<?php echo $_SESSION['userid']; ?>" /></div>
						</div>
					</form>
				</div></div>
				<div class="box">
					<div class="title">
						Referrals statistics</strong>
						<span class="hide"></span>
					</div>
					<div class="content">
						<table cellspacing="0" cellpadding="0" border="0"> 
							<thead> 
								<tr>
									<th>Referrals</th>
									<th>Earnings</th>
								</tr>
							</thead>
							<tbody>
							<?php $res = $earnings->getReferralEarnings($_SESSION['userid'])?>
							 <?php if(mysql_num_rows($res)>0){
  	                                                 while($fetched_rows1 = mysql_fetch_assoc($res)){ ?>
							        <tr>
									<td><?php echo $fetched_rows1['username'];?></td>
									<td><?php echo '$'.$fetched_rows1['amt'];?></td>
								</tr>
							<?php }} else { ?>
							        <tr>
							                 <td>0</td>
							                 <td>$0</td>
							         </tr>
							<?php } ?>
							</tbody>
						</table>
					</div>
				</div>
				</div>
			</div>
		</div>
<?php include 'footer.php'; ?>